﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;

namespace VTV.TaskManagementSystem.WebApp.Admin
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserID"] == null || Session["UserName"] == null || Session["RoleLevel"] == null)
            {
                Response.Redirect("../Admin/Login.aspx");
            }
        }

        protected void addTab_Employees(object sender, DirectEventArgs e)
        {
            var empTab = new Ext.Net.Panel()
                             {
                                 Title = "Nhân viên",
                                 ID = "pnlEmployees",
                                 BodyPadding = 6,
                                 Closable = true,
                                 AutoScroll = true,
                                 Icon = Icon.UserHome,
                                 Loader = new ComponentLoader(new ComponentLoader.Config()
                                 {
                                     Url = "Employees/List.aspx",
                                     Mode = LoadMode.Frame
                                 })
                             };
            empTab.Loader.LoadMask.ShowMask = true;
            empTab.AddTo(this.tabPnlContent);
            tabPnlContent.SetActiveTab(empTab.ID);
            empTab.LoadContent();

        }

        protected void addTab_Teams(object sender, DirectEventArgs e)
        {
            var currentTab = this.tabPnlContent.FindControl("pnlTeam");
            if (currentTab != null)
            {
                //tabPnlContent.SetActiveTab(currentTab[0].ID);
            }
            else
            {
                var empTab = new Ext.Net.Panel()
                {
                    Title = "Nhóm",
                    ID = "pnlTeam",
                    BodyPadding = 6,
                    Closable = true,
                    AutoScroll = true,
                    Icon = Icon.Group,
                    Loader = new ComponentLoader(new ComponentLoader.Config()
                    {
                        Url = "Team/List.aspx",
                        Mode = LoadMode.Frame
                    })
                };

                empTab.Loader.LoadMask.ShowMask = true;
                empTab.AddTo(this.tabPnlContent);
                tabPnlContent.SetActiveTab(empTab.ID);
                empTab.LoadContent();
            }
        }
    }
}